{% import 'macros.html' as mymacros %}
{% if obj.direction == IVTNT_IN %}
    {% set label = '入库' %}
{% elif obj.direction == IVTNT_OUT %}
    {% set label = '出库' %}
{% elif obj.direction == IVTNT_INTERNAL %}
    {% set label = '内部转仓' %}
{% endif %}
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3>{{ label }}单预览</h3>
</div>
<div class="modal-body">
    <div class="col-md-4">
        <h4>系统编号</h4><p>{{obj.no}}</p>
        {% if obj.direction == IVTNT_IN %}
            <h4>从&nbsp;[{{obj.ivt.name|ss(c='IVTNAME')}}]&nbsp;入库</h4><p>&nbsp;</p>                
        {% elif  obj.direction == IVTNT_OUT %}
            <h4>出库到&nbsp;[{{obj.ivt.name|ss(c='IVTNAME')}}]</h4><p>&nbsp;</p>
        {% endif %}
    </div>
    <div class="col-md-4">
        <h4>经办人</h4><p>{{obj.createBy|f}}&nbsp;</p>
        <h4>开单时间</h4><p>{{obj.createTime|fd}}</p>
    </div>
    <div class="col-md-4">
        <h4>备注</h4><p>{{obj.remark|f}}&nbsp;</p>
    </div>
    <div class="col-md-4">
     <h4>附件</h4>
        {{mymacros.render_preview_all_attachment(obj.attachment)}}
    </div>
    <div class="clearfix">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td width='202px'>商品编号/名称</td>
                    <td class="col-md-3">商品描述</td>
                    {% if obj.direction == IVTNT_IN %}
                        <td  class="col-md-2">入库仓位</td>
                    {% elif obj.direction == IVTNT_OUT %}
                        <td class="col-md-2">所在仓位</td>
                    {% endif %}
                    <td class="col-md-1">{{label}}数量</td>
                    <td>备注</td>      
                </tr>
            </thead>
            <tbody>
                {% for r in obj.dtls %}
                    <tr>
                        <td>{{mymacros.render_goto_popup_pdt(r.pdt, loop.first)}} {{r.pdtname|f}}</td>
                        <td>{{r.pdtfulldesc|f}}</td>
                        {% if obj.direction == IVTNT_IN %}
                            <td>{{r.dIvtLtn|f}}</td>
                        {% elif obj.direction == IVTNT_OUT %}
                            <td>{{r.sIvtLtn|f}}</td>
                        {% endif %}
                        <td>
                            <div class="btn-group">
                              <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                {{r.qty}}
                                <span class="caret"></span>
                              </a>
                              <ul class="dropdown-menu">
                                  <li>&nbsp;相关的商品个体</li>
                                  <li class="divider"></li>
                                   {% for no in r.itemList %}
                                        <li>&nbsp;{{no}}</li>
                                    {% endfor %}
                              </ul>
                            </div> 
                        </td>
                        <td>{{r.remark|f}}&nbsp;</td>
                    </tr>
                {% endfor %}
            </tbody>                
        </table>
    </div>
</div>
<div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-primary">{{BTN_CLOSE}}</button>
</div>